package com.rosado.appfirst;

import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

import javax.servlet.ServletException;
import javax.servlet.http.*;

@SuppressWarnings("serial")
public class AppfirstServlet extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws IOException, ServletException {
		
		// resp.setContentType("text/html");
		// resp.getWriter().println("<html><head><meta http-equiv='content-type' content='text/html; charset=UTF-8'><title>Hello App Engine</title></head><body><img src='https://developers.google.com/appengine/images/appengine-noborder-120x30.gif' alt='Powered by Google App Engine' /></html></body>");

		
		Date date_heure = new Date();
		
		Locale FR = Locale.FRANCE;
		
		DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy", FR);
		DateFormat heureFormat = new SimpleDateFormat("HH:mm", FR);
		String dateString = dateFormat.format(date_heure);
		String heureString = heureFormat.format(date_heure);
		
		request.setAttribute("Date", dateString );
		request.setAttribute( "Heure", heureString );
		
		this.getServletContext().getRequestDispatcher("/home.jsp").forward( request, response );

	}
}
